from django.http import HttpResponse

from reports import RelatorioMedicos
from geraldo.generators import PDFGenerator
from models import Medico

def relatorio(request):
    resp = HttpResponse(mimetype='application/pdf')

    medico = Medico.objects.order_by('nome','id','crm')
    rel = RelatorioMedicos(queryset=medico)
    rel.generate_by(PDFGenerator, filename=resp)

    return resp
